import axios from '../../../plugins/axios'
import { CategoryActionsEnum } from '../../../_/vue/store/category'

export default {
  [CategoryActionsEnum.LIST] ({ commit }, params) {
    return axios.get('/category', { params })
  },
  [CategoryActionsEnum.STORE] ({ commit }, data) {
    return axios.post('/category', data)
  },
  [CategoryActionsEnum.EDIT] ({ commit }, id) {
    return axios.get(`/category/${id}`)
  },
  [CategoryActionsEnum.SAVE] ({ commit }, payload) {
    return axios.post(`/category/${payload.id}`, payload.data)
  },
  [CategoryActionsEnum.DELETE] ({ commit }, ids) {
    return axios.delete('/category', { data: ids })
  },
  [CategoryActionsEnum.SELECT] ({ commit }) {
    return axios.get('/category/select')
  }
}
